n = int(input())
w = list(map(int, input().split()))
v = list(map(int, input().split()))
W = int(input())
dp = [[0] * (W + 1) for i in range(n + 1)]
import itertools
n = int(input())
p = list(map(int, input().split()))
ans = set()
for i in itertools.product([0, 1], repeat=len(p)):
res = 0
for idx, j in enumerate(i):
if j:
res += p[idx]
ans.add(res)
print(len(ans))
n = int(input())
p = list(map(int, input().split()))
dp = [0 for _ in range(10**5)]
dp[0] = 1
for i in p:
dp[i] = 1
# それぞれ一個ずつしか使えない
# for i in p:
# for j in range(10**5):
# if dp[j] and i + j < 10**5:
# dp[j+i] = 1
print(dp[:15])
n = int(input())
p = list(map(int, input().split()))
dp = [0] * 10001
dp[0] = 1
# p は順番に走査して問題ない
for v in p:
for i in range(10001 - v, -1, -1): # 今回加算した分が影響しないように上から見ていく
if dp[i]:
dp[i + v] = 1
# print(dp)
# [1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0,
print(sum(dp))